<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script>
	Function.prototype.method = function(name,func){  //Function.prototype을 추가할때 .prototype을  사용하지 않아도 된다. 
		this.prototype[name] = func;
		return this;
	}
	
	String.method('deentityify',function(){
		var entity={
				quot:'"',
				lt:'<',
				gt:'>'
		};
		return  function(){
			return this.replace(/&([^&;]+);/g,function(a,b){
				var r = entity[b];
				return typeof r==='string'?r:a;
				}
			);
		};
	}());
	
	pt("&lt;xxxxxx&gt;".deentityify());
	
	function pt(str){
		document.write("<br>"+str);
	}

</script>
</head>
<body>

</body>
</html>